package com.itheima.sh.e_test;

import java.util.Arrays;

public class Test01 {
    public static void main(String[] args) {
        //创建静态数组
       int[]arr={11,22,33,44,55,66};
        //创建动态数组
        int[] arr1 = new int[arr.length];
        //设置起始索引
        int startIndex = 0;
        //设置尾索引
        int endIndex = arr1.length-1;
        //遍历静态数组 获取数据
        for (int i = 0; i < arr.length; i++) {
            //判断元素是否为奇数/偶数
            if (arr[i]%2==1) {
                arr1[startIndex]=arr[i];
                startIndex++;
            }else {
                arr1[endIndex]=arr[i];
                endIndex--;
            }
        }
        //打印数组
        System.out.println(Arrays.toString(arr1));
    }

    }

